package com.brspace.qualitycontrol.controller.admin;

import com.brspace.qualitycontrol.entity.Role;
import com.brspace.qualitycontrol.service.RoleService;
import com.brspace.qualitycontrol.utils.R;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiParam;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

/**
 * @Author wangt
 * @Date 2021/4/15 20:09
 * @Version 1.0
 */
@Api(description = "角色管理")
@RestController
@RequestMapping("/admin/role")
public class RoleController {
    @Resource
    private RoleService roleService;
    /**
     * 角色列表
     * @Author: wangt
     * @Date: 2021-04-21 13:53:39
     */
    @ApiParam("角色列表")
    @GetMapping("list")
    public R list(){
        return R.ok().data("list",roleService.list());
    }
    /**
     * 新增角色
     * @Author: wangt
     * @Date: 2021-04-21 15:05:58
     */
    @ApiParam("新增角色")
    @PostMapping("add")
    public R add(@RequestBody Role role){
        roleService.add(role);
        return R.ok();
    }

}
